using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler;

namespace RaycasterXPipeline
{
	[ContentTypeWriter]
	public class MapWriter : ContentTypeWriter<MapContent>
	{
        protected override void Write(ContentWriter output, MapContent value)
        {
            //write out the number of textures
            output.Write(value.Textures.Count);

            //write out all the textures
            foreach (var t in value.Textures)
                output.WriteExternalReference(t);

            //write out the background texture
            output.WriteExternalReference(value.Background);

            //write out the number of map rows
            output.Write(value.Rows.Count);

            //write out each row
            foreach (var r in value.Rows)
                output.WriteObject(r);
        }

        public override string GetRuntimeReader(TargetPlatform targetPlatform)
        {
            //Change by Patrick Pelletier - 20091120
            //return "RaycasterX.MapReader, RaycasterX";
            return typeof(RaycasterX.MapReader).AssemblyQualifiedName;
            //End of change
        }
	}
}
